<?php

namespace app\job;

use think\queue\Job;

class Task
{

    public function fire(Job $job, $data)
    {

        $rt = $this->doJob($data);
        if($rt){
            $job->delete();
            return true;
        }

        // 重试三次失败 todo...
        if($job->attempts() == 3){
            $job->delete();
            return false;
        }

        //执行失败10S后重试
        $job->release(10);

    }

    public function doJob($data)
    {
        if (array_key_exists('data',$data)){
            $row = $data['data'];
			
        }
        return true;
    }



}